home *** CD-ROM | disk | FTP | other *** search
- Path: keats.ugrad.cs.ubc.ca!not-for-mail
- From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
- Newsgroups: comp.lang.c
- Subject: Re: Best way to insert in file
- Date: 25 Feb 1996 16:44:41 -0800
- Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
- Message-ID: <4gqvppINNh86@keats.ugrad.cs.ubc.ca>
- References: <4gldjl$cck@news.fwi.com> <1996Feb25.164738.7783@zcon.com>
- NNTP-Posting-Host: keats.ugrad.cs.ubc.ca
-
- In article <1996Feb25.164738.7783@zcon.com>,
- Syed Zaeem Hosain <szh@zcon.com> wrote:
- >In article <4gldjl$cck@news.fwi.com>, stork@serv2.fwi.com (Bryan Liles) writes:
- >>What would be the best way to insert data in to the middle of a text file?
- >>I have a program that is supposed to automatically fill out an application.
- >>(its a an internic domain app)
- >
- >Please look at the FAQ and read question 19.14 and its answer. It
- >addresses your question exactly. For reference, here is the question
- >(with answer deleted, to make you go look and hopefully remember to
- >read the FAQ before posting next time <smile>):
- >
- >19.14: How can I insert or delete a line (or record) in the middle of a
- > file?
- >
- >If you do not have the comp.lang.c FAQ, it can be found at rtfm.mit.edu
- >in an appropriate subdirectory of /pub/usenet/.
-
- Of course, the real answer is to avoid writing a C program, and use a filter
- utility called "sed". I have used this little program to edit the 200,000+th
- line of a 400,000 line text file. Writing C code to do the same thing is
- redundant, considering that sed can do all kinds of things to a file other than
- just insert and delete lines.
-
- Those who don't know UNIX are bound to repeat it... badly.
- --
-
-